import { http } from "@/utils/http";
import { baseUrlApi } from "../utils";

interface CaseAnalysisRecord {
  status: number;
  msg: string;
  data: {
    pageIndex: number;
    pageCount: number;
    totalCount: number;
    pageSize: number;
    keyword: string;
    list: [
      {
        menuId: string;
        menuName: string;
        parentMenuName: string;
        userId: string;
        userName: string;
        caseAnalysis: string;
        comments: string;
        evaluation: string;
        state: string;
        classId: string;
        planId: string;
      }
    ];
  };
  success: boolean;
}

interface analysis {
  status: number;
  msg: string;
  data: boolean;
  success: boolean;
}

interface LoadCaseAna {
  status: number;
  msg: string;
  data: {
    caseAnalysis: string;
    comments: string;
    evaluation: string;
    state: string;
    isSubmit: boolean;
  };
  success: boolean;
}

//获取大数据处理任务列表
export const CaseAnalysisRecordGetAll = (data: object) => {
  return http.request<CaseAnalysisRecord>(
    "post",
    baseUrlApi("/CaseAnalysisRecord/GetAll"),
    {
      data
    }
  );
};
// 学生端 加载案例分析内容
export const LoadCaseAnalysisRecord = (params: string) => {
  return http.request<LoadCaseAna>(
    "get",
    baseUrlApi("/CaseAnalysisRecord/LoadCaseAnalysisRecord?" + params)
  );
};

// 暂存 or 提交 案例分析记录
export const SaveOrSubmitCaseAnalysis = (data: object) => {
  return http.request<analysis>(
    "post",
    baseUrlApi("/CaseAnalysisRecord/SaveOrSubmitCaseAnalysis"),
    {
      data
    }
  );
};

// 获取任务详情
export const taskGetTaskDetail = (params: string) => {
  return http.request<any>("get", baseUrlApi("/task/GetTaskDetail?" + params));
};

export const OperationLogGetLogByBusinessType = (data: object) => {
  return http.request<any>(
    "post",
    baseUrlApi("/OperationLog/GetLogByBusinessType"),
    {
      data
    }
  );
};

// 获取 python与大数据、 大数据应用案例 的任务详情
export const LoadResourcesGetTaskDatail = (params: string) => {
  return http.request<any>(
    "get",
    baseUrlApi("/LoadResources/GetTaskDatail?" + params)
  );
};
